package cn.wit.summit.chwan.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by yangg on 2018/4/19.
 */

public class RegularUtil {

    /**
     * 正则手机号码
     * @param iphone 要验证的手机号码
     * @return true为正确
     */
    public static boolean getIphoneCorrect(String iphone) {
        String PHONE_PATTERN = "^((13[0-9])|(14[0-9])|(17[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$";
        Pattern pattern = Pattern.compile(PHONE_PATTERN);
        Matcher matcher = pattern.matcher(iphone);
        if (matcher.find())
            return true;
        return false;

    }

    public static boolean getPwd(String pwd){
         String PWD_PATTERN="^([a-zA-Z0-9]){6,20}$";
        Pattern pattern = Pattern.compile(PWD_PATTERN);
        Matcher matcher = pattern.matcher(pwd);
        if (matcher.find())
            return true;
        return false;
    }


}
